log using Figure_1, replace
/**********************/
/*Clean and set memory*/
/**********************/
clear all
set matsize 5000
set more off

/******************/
/*Install programs*/
/******************/

/*********************/
/*Sets base directory*/
/*********************/
global project "D:\IMF_INE_2_2021"  /* Set base directory                         */

/***************************************/
/*Analysis of propensity to participate in an IMF program*/
/***************************************/
use "$project/imf_ehii_code.dta"
/*Drop high-income countries*/
gen high=.
replace high=1 if cname=="Andorra"
replace high=1 if cname=="Antigua and Barbuda"
replace high=1 if cname=="Aruba"
replace high=1 if cname=="Australia"
replace high=1 if cname=="Austria"
replace high=1 if cname=="Bahamas, The"
replace high=1 if cname=="Bahrain"
replace high=1 if cname=="Barbados"
replace high=1 if cname=="Belgium"
replace high=1 if cname=="Bermuda"
replace high=1 if cname=="British Virgin Islands"
replace high=1 if cname=="Brunei Darussalam"
replace high=1 if cname=="Canada"
replace high=1 if cname=="Cayman Islands"
replace high=1 if cname=="Channel Islands"
replace high=1 if cname=="Chile"
replace high=1 if cname=="Croatia"
replace high=1 if cname=="Curacao"
replace high=1 if cname=="Cyprus"
replace high=1 if cname=="Czech Republic"
replace high=1 if cname=="Denmark"
replace high=1 if cname=="Estonia"
replace high=1 if cname=="Faroe Islands"
replace high=1 if cname=="Finland"
replace high=1 if cname=="France"
replace high=1 if cname=="French Polynesia"
replace high=1 if cname=="Germany"
replace high=1 if cname=="Gibraltar"
replace high=1 if cname=="Greece"
replace high=1 if cname=="Greenland"
replace high=1 if cname=="Guam"
replace high=1 if cname=="Hong Kong SAR, China"
replace high=1 if cname=="Hungary"
replace high=1 if cname=="Iceland"
replace high=1 if cname=="Ireland"
replace high=1 if cname=="Isle of Man"
replace high=1 if cname=="Israel"
replace high=1 if cname=="Italy"
replace high=1 if cname=="Japan"
replace high=1 if cname=="Korea, Rep."
replace high=1 if cname=="Kuwait"
replace high=1 if cname=="Latvia"
replace high=1 if cname=="Liechtenstein"
replace high=1 if cname=="Lithuania"
replace high=1 if cname=="Luxembourg"
replace high=1 if cname=="Macao SAR, China"
replace high=1 if cname=="Malta"
replace high=1 if cname=="Monaco"
replace high=1 if cname=="Nauru"
replace high=1 if cname=="Netherlands"
replace high=1 if cname=="New Caledonia"
replace high=1 if cname=="New Zealand"
replace high=1 if cname=="Northern Mariana Islands"
replace high=1 if cname=="Norway"
replace high=1 if cname=="Oman"
replace high=1 if cname=="Palau"
replace high=1 if cname=="Poland"
replace high=1 if cname=="Portugal"
replace high=1 if cname=="Puerto Rico"
replace high=1 if cname=="Qatar"
replace high=1 if cname=="San Marino"
replace high=1 if cname=="Saudi Arabia"
replace high=1 if cname=="Seychelles"
replace high=1 if cname=="Singapore"
replace high=1 if cname=="Sint Maarten (Dutch part)"
replace high=1 if cname=="Slovak Republic"
replace high=1 if cname=="Slovenia"
replace high=1 if cname=="Spain"
replace high=1 if cname=="St. Kitts and Nevis"
replace high=1 if cname=="St. Martin (French part)"
replace high=1 if cname=="Sweden"
replace high=1 if cname=="Switzerland"
replace high=1 if cname=="Trinidad and Tobago"
replace high=1 if cname=="Turks and Caicos Islands"
replace high=1 if cname=="United Arab Emirates"
replace high=1 if cname=="United Kingdom"
replace high=1 if cname=="United States"
replace high=1 if cname=="Uruguay"
replace high=1 if cname=="Virgin Islands (U.S.)"

drop if high==1

bysort year: egen avg = mean(ehii)

twoway (line avg year,  fcolor(*.1) lc(black) fc(black) ) ,  legend(off) xlabel(1970(5)2015, angle(vertical)) xtitle("") graphregion(color(white)) ytitle("EHII index")

graph save "$project/FIGURE1/Figure_1.gph",  replace /*Plots and saves figure 1*/

log close

translate Figure_1.smcl Figure_1.pdf

